<template>

	<view class="resourceList">
		<uni-row style="margin-top: 20rpx;">
			<uni-col :span="12" style="padding-right: 15rpx;">
				<uni-data-select placeholder="所有仓库" v-model="queryParams.warehouseId" :localdata="warehouseList" style="background-color: #fff;">
				</uni-data-select>
			</uni-col>
			<uni-col :span="12">
				<uni-easyinput style="background-color: #fff;" suffixIcon="search" v-model="queryParams.materialName" placeholder="查询物料" @iconClick="queryClick"></uni-easyinput>
			</uni-col>
		</uni-row>

		<view v-for="(item,index) in inventoryList" style="margin-top: 10rpx;">
			<uni-group mode="card">
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						仓库:&nbsp;&nbsp;&nbsp;{{item.warehouseName}}
					</text>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						物料:&nbsp;&nbsp;&nbsp;{{item.materialName}} &nbsp;&nbsp;&nbsp;({{item.materialNumber}})
					</text>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						规格型号:&nbsp;&nbsp;&nbsp;{{item.specification}}
					</text>
				</uni-row>

				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						数量:&nbsp;&nbsp;&nbsp;{{item.quantity}} &nbsp;&nbsp;&nbsp;({{item.materialUnitName}})
					</text>
				</uni-row>
			</uni-group>
		</view>
	</view>

</template>

<script>
	import {
		getUserProfile
	} from "@/api/system/user"
	import {
		getDicts
	} from "@/api/system/dict/data";
	import {
		listInventory,
		getInventory
	} from "@/api/warehouse/inventory";
	import {
		listWarehouse
	} from "@/api/warehouse/warehouse";
	export default {
		data() {
			return {
				queryParams: {pageSize: 99999},
				//库存列表
				inventoryList: [],
				warehouseList: [],
			}
		},
		created() {
			this.getWarehouse();
			this.getList();
		},
		methods: {
			/** 查询列表 */
			getList() {
				listInventory(this.queryParams).then(reportResponse => {
					this.inventoryList = reportResponse.rows
				})
			},
			getWarehouse(){
				listWarehouse({pageSize: 99999}).then(response => {
					let list = [];
					list = response.rows;
					for (let i = 0; i < list.length; i++) {
						list[i].value = list[i].id;
						list[i].text = list[i].name;
						this.warehouseList.push(list[i]);
					}
				});
			},
			queryClick(){
				this.getList();
			}
		},
	}
</script>

<style>
	.resourceList-uni-row {
		margin-bottom: 8rpx;
	}

	.resourceList-text {
		font-size: 16px;
	}

	.resourceList {
		margin-left: 10px;

	}

	.uni-input {
		height: 50rpx;
		padding: 15rpx 25rpx;
		line-height: 50rpx;
		font-size: 28rpx;
		background: #FFF;
		flex: 1;
	}
</style>
